package com.ztesoft.huangfu.learning.springboot.springbootssoauth2.dao;

import com.ztesoft.huangfu.learning.springboot.springbootssoauth2.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * Created with IntelliJ IDEA.
 * Author: huangfu.daohui
 * Date: 2018/6/21
 * Time: 19:00
 * Version: 1.0
 * Description:
 **/
public interface UserJPA extends JpaRepository<User, String> {

    @Query("SELECT u FROM User u WHERE LOWER(u.username) = LOWER(:username)")
    User findByUsernameCaseInsensitive(@Param("username") String username);

}
